#include "stdio.h"
#include "CH554.H"
#include "NRF24L01.h"
#include "SPI.h"
#include "stdio.h"
#include <string.h>

unsigned int i = 0;

sbit  KEY = P3 ^ 3;
sbit  LED = P3 ^ 0;

/* TX:  P3.1/PWM2/TXD */
/* RX:  P3.0/PWM1/RXD */

/* baudrate: 57600 */

unsigned char  checked = 0;
main()
{

    CfgFsys();
    mInitSTDIO();
//	printf("DEBUG_DATE:"__DATE__"\nDEBUG_TIME:"__TIME__"\n");



//    SPI_Init();
//    mDelaymS(200);
//	SPI_RW(0x41);
//	
//	while(1);

//    printf("start ...\n");
//    checked = NRF24L01_Check();
//    printf("checked ...%d \n", checked);
    while(NRF24L01_Check());
//    printf("checked ...%d \n", checked);

    NRF24L01_Init();
    NRF24L01_TX_Mode();
    nrf24l01_buf[0] = 0x41;
    nrf24l01_buf[1] = 0x42;
    nrf24l01_buf[2] = 0x45;
    nrf24l01_buf[3] = 0x46;
    nrf24l01_buf[4] = 0x43;

    while(1)
    {
//		printf("DEBUG_DATE:"__DATE__"\nDEBUG_TIME:"__TIME__"\n");
//		while(!KEY);
//		LED=!LED;
//			i=10000;while(i--);
//        printf("checked ...%x\n", NRF24L01_Check());
        mDelaymS(1000);
        NRF24L01_TxPacket(nrf24l01_buf);

        nrf24l01_buf[0] += 5;
        nrf24l01_buf[1] += 5;
        nrf24l01_buf[2] += 5;
        nrf24l01_buf[3] += 5;
        nrf24l01_buf[4] += 5;
    }
	/*	*/
}